import request from '@/utils/request'

// 查询商品库存列表
export function listInventory(query) {
  return request({
    url: '/supermarket/inventory/list',
    method: 'get',
    params: query
  })
}

// 查询商品库存详细
export function getInventory(id) {
  return request({
    url: '/supermarket/inventory/' + id,
    method: 'get'
  })
}

// 新增商品库存
export function addInventory(data) {
  return request({
    url: '/supermarket/inventory',
    method: 'post',
    data: data
  })
}

// 修改商品库存
export function updateInventory(data) {
  return request({
    url: '/supermarket/inventory',
    method: 'put',
    data: data
  })
}

// 删除商品库存
export function delInventory(id) {
  return request({
    url: '/supermarket/inventory/' + id,
    method: 'delete'
  })
}

// 新增出库商品
export function addOutInventory(data) {
  return request({
    url: '/supermarket/inventory/outInventory',
    method: 'post',
    data: data
  })
}
// 根据商品code查询商品信息
export function getInventoryByCode(params) {
  return request({
    url: '/supermarket/inventory/addInventory',
    method: 'get',
    params
  })
}

// 新增入库商品 /admin/supermarket/inventory/addInventory
export function addPutInventory(data) {
  return request({
    url: '/supermarket/inventory/addInventory',
    method: 'post',
    data: data
  })
}
